﻿/*================================================================================================
 * 
 * NAME: Timer.cs
 * AUTH: Matthew Baum, 9753095
 * 
 * DATE: 10/10/11
 * LAST: 10/13/11
 * 
 * DESC: C# class file describing a timer utility that counts down to the end of the game.
 * 
 * NOTE: The timeLeft is updated in the game's update function, using
 *       gameTime.TotalGameTime.
 * 
 *================================================================================================*/

using System;
using Microsoft.Xna.Framework;

namespace Asteroid_Mod.Util
{
    class Timer
    {
        // Initial and remaining time
        private TimeSpan initTime;
        private TimeSpan timeLeft;

        // Time Limit: 3 minutes
        private const Int64 LIMIT = 1800000000;

        // Conctructor
        public Timer()
        {
            initTime = new TimeSpan( LIMIT );
            timeLeft = new TimeSpan();
        }

        // Update ammount of time left
        public void update( TimeSpan elapsed )
        {
            timeLeft = initTime - elapsed;
        }

        // ToString function
        public override String ToString()
        {
            return timeLeft.Minutes + " : " + timeLeft.Seconds;
        }
    }
}

/*================================================================================================
 * END FILE
 *================================================================================================*/
